package com.owc.service;

import com.owc.domain.PageBean;
import com.owc.domain.UserExample;
import com.owc.domain.dto.*;
import com.owc.domain.entity.Token;
import com.owc.domain.vo.app.AuthCodeVo;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

import java.util.List;
import java.util.Optional;
import java.util.Set;

public interface OwcService {

    /**
     * Send phone verification code
     * @param authCodeVo model.
     * @return flag
     */
    boolean sendCode(AuthCodeVo authCodeVo);

    /**
     * Get system config with database.
     */
    <T> T getSystemConfig(String key,Class<T> cls);

    /**
     * Get token name by Id
     * @param tokenId  id
     * @return tokenName
     */
    String getTokenName(Long tokenId);

    /**
     * Get h5 address.
     */
    H5 getH5Url();

    /**
     * Get newest version.
     */
    VersionDTO getVersionInfo();

    /**
     * Get transfer notice message
     */
    TransferNotice getTransferNotice();

    /**
     * User or adminUser model trans to UserExample model.
     */
    <T> Optional<UserExample> converterFromExample(@Nullable T t);

    CommonInfo getCommonInfo(Long tokenId);

    /**
     * Query all Defined token.
     */
    List<Token> getAllToken();

    /**
     * Fetch all notice.
     */
    PageBean<NoticeDTO> getNotices(Integer pageIndex,Integer pageSize);

    /**
     * Get user history already read notice id list.
     * @return ids
     */
    Set<Long> getLastReadNoticeIds(Long userId);

    /**
     * Cache already read notice id.
     * @param userId  User id
     * @param ids     notice ids.
     */
    void cacheReadNoticeIds(Long userId,List ids);

    /**
     * Check if exist new notice.
     */
    CheckNoticeDTO checkNotice();

    /**
     * Set global default attributes
     * @param <T> source
     * @return source
     */
    <T> T injectDefaultAttr(T source);

    /**
     * Get APP common notice info.
     */
    List<CommonInfoDTO> getOwcBasisInfo();

}
